<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>History 对象</title>
</head>
<body>

<input id="btn" type="button" value="获取历史记录个数">
<a href="9_history对象2.html">9_history对象2</a>

<input id="forward" type="button" value="前进">


<script>
  // 获取按钮
  var btn = document.getElementById("btn");
  // 绑定事件
  btn.onclick = function() {
    // 获取历史记录个数
    var length = history.length;
    alert(length);
  }

  var forward = document.getElementById("forward");
  // 绑定事件
  forward.onclick = function() {
    //history.forward();
    history.go(1);
  }


</script>

</body>
</html>